import {
  BwComPropSetConstValueComEnum,
  BwCustomComSoltTypeEnum,
  BwCustomComPropDataTypeEnum,
  BwCustomComEmitParamDataTypeEnum,
  BwCustomComSlotParamDataTypeEnum,
} from '../../../render/models'
import type {
  BwCustomComEmitInfoModel,
  BwCustomComSlotInfoModel,
  BwCustomComPropInfoModel,
} from '../../../render/models'

/** 组件属性 */
const comAttrs: Array<BwCustomComPropInfoModel> = [
  {
    key: 'class',
    name: 'classNames',
    isRequire: false,
    defaultValue: undefined,
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.array,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'type',
    name: '列的类型',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        {
          label: '序号',
          value: 'seq',
        },
        {
          label: '复选框',
          value: 'checkbox',
        },
        {
          label: '单选框',
          value: 'radio',
        },
        {
          label: '展开行',
          value: 'expand',
        },
        {
          label: 'HTML 标签',
          value: 'html',
        },
      ],
    }),
    remark: '',
  },
  {
    key: 'field',
    name: '列字段名',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'title',
    name: '列标题',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'width',
    name: '列宽度',
    isRequire: false,
    defaultValue: undefined,
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.number,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'min-width',
    name: '最小列宽度',
    isRequire: false,
    defaultValue: undefined,
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.number,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'resizable',
    name: '列是否允许拖动列宽调整大小',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'visible',
    name: '默认是否显示',
    isRequire: false,
    defaultValue: 'true',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'fixed',
    name: '将列固定在左侧或者右侧',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        {
          label: '冻结左侧',
          value: 'left',
        },
        {
          label: '冻结右侧',
          value: 'right',
        },
      ],
    }),
    remark: '',
  },
  {
    key: 'align',
    name: '列对齐方式',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        {
          label: '左对齐',
          value: 'left',
        },
        {
          label: '居中对齐',
          value: 'center',
        },
        {
          label: '右对齐',
          value: 'right',
        },
      ],
    }),
    remark: '',
  },
  {
    key: 'header-align',
    name: '表头列的对齐方式',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        {
          label: '左对齐',
          value: 'left',
        },
        {
          label: '居中对齐',
          value: 'center',
        },
        {
          label: '右对齐',
          value: 'right',
        },
      ],
    }),
    remark: '',
  },
  {
    key: 'footer-align',
    name: '表尾列的对齐方式',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        {
          label: '左对齐',
          value: 'left',
        },
        {
          label: '居中对齐',
          value: 'center',
        },
        {
          label: '右对齐',
          value: 'right',
        },
      ],
    }),
    remark: '',
  },
  {
    key: 'show-overflow',
    name: '当内容过长时显示为省略号',
    isRequire: false,
    defaultValue: undefined,
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.boolean,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        {
          label: '只显示省略号',
          value: 'ellipsis',
        },
        {
          label: '显示为原生 title',
          value: 'title',
        },
        {
          label: '显示为 tooltip 提示',
          value: 'tooltip',
        },
      ],
    }),
    remark: '',
  },
  {
    key: 'show-header-overflow',
    name: '当表头内容过长时显示为省略号',
    isRequire: false,
    defaultValue: undefined,
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.boolean,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        {
          label: '只显示省略号',
          value: 'ellipsis',
        },
        {
          label: '显示为原生 title',
          value: 'title',
        },
        {
          label: '显示为 tooltip 提示',
          value: 'tooltip',
        },
      ],
    }),
    remark: '',
  },
  {
    key: 'show-footer-overflow',
    name: '当表尾内容过长时显示为省略号',
    isRequire: false,
    defaultValue: undefined,
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.boolean,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        {
          label: '只显示省略号',
          value: 'ellipsis',
        },
        {
          label: '显示为原生 title',
          value: 'title',
        },
        {
          label: '显示为 tooltip 提示',
          value: 'tooltip',
        },
      ],
    }),
    remark: '',
  },
  {
    key: 'class-name',
    name: '给单元格附加 className',
    isRequire: false,
    defaultValue: undefined,
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      // BwCustomComPropDataTypeEnum.function,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'header-class-name',
    name: '给表头的单元格附加 className',
    isRequire: false,
    defaultValue: undefined,
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      // BwCustomComPropDataTypeEnum.function,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'footer-class-name',
    name: '给表尾的单元格附加 className',
    isRequire: false,
    defaultValue: undefined,
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      // BwCustomComPropDataTypeEnum.function,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  // {
  //   key: 'formatter',
  //   name: '格式化显示内容',
  //   isRequire: false,
  //   defaultValue: undefined,
  //   dataType: [
  //     BwCustomComPropDataTypeEnum.function,
  //   ],
  //   defaultValueDataType: BwCustomComPropDataTypeEnum.function,
  //   constValueSetCom: BwComPropSetConstValueComEnum.function,
  //   constValueSetComProps: null,
  //   remark: '',
  // },
  {
    key: 'sortable',
    name: '数据排序，是否允许列排序',
    isRequire: false,
    defaultValue: 'false',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'sort-by',
    name: '数据排序，只对 sortable 有效，指定排序的字段',
    isRequire: false,
    defaultValue: undefined,
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      // BwCustomComPropDataTypeEnum.function,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'sort-type',
    name: '数据排序，排序的字段类型',
    isRequire: false,
    defaultValue: 'auto',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        {
          label: '自动',
          value: 'auto',
        },
        {
          label: '数字',
          value: 'number',
        },
        {
          label: '字符串',
          value: 'string',
        },
      ],
    }),
    remark: '',
  },
  {
    key: 'filters',
    name: '数据筛选，配置筛选条件',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.array],
    defaultValueDataType: BwCustomComPropDataTypeEnum.array,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'filter-multiple',
    name: '筛选是否允许多选',
    isRequire: false,
    defaultValue: 'true',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  // {
  //   key: 'filter-method',
  //   name: '列的筛选方法，该方法的返回值用来决定该行是否显示',
  //   isRequire: false,
  //   defaultValue: undefined,
  //   dataType: [BwCustomComPropDataTypeEnum.function],
  //   defaultValueDataType: BwCustomComPropDataTypeEnum.function,
  //   constValueSetCom: BwComPropSetConstValueComEnum.function,
  //   constValueSetComProps: null,
  //   remark: '',
  // },
  // {
  //   key: 'filter-reset-method',
  //   name: '自定义筛选重置方法',
  //   isRequire: false,
  //   defaultValue: undefined,
  //   dataType: [BwCustomComPropDataTypeEnum.function],
  //   defaultValueDataType: BwCustomComPropDataTypeEnum.function,
  //   constValueSetCom: BwComPropSetConstValueComEnum.function,
  //   constValueSetComProps: null,
  //   remark: '',
  // },
  // {
  //   key: 'filter-recover-method',
  //   name: '自定义筛选复原方法',
  //   isRequire: false,
  //   defaultValue: undefined,
  //   dataType: [BwCustomComPropDataTypeEnum.function],
  //   defaultValueDataType: BwCustomComPropDataTypeEnum.function,
  //   constValueSetCom: BwComPropSetConstValueComEnum.function,
  //   constValueSetComProps: null,
  //   remark: '',
  // },
  {
    key: 'filter-render',
    name: '数据筛选，筛选渲染器配置项',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.object],
    defaultValueDataType: BwCustomComPropDataTypeEnum.object,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  // {
  //   key: 'header-export-method',
  //   name: '自定义表头单元格数据导出方法，返回自定义的标题',
  //   isRequire: false,
  //   defaultValue: undefined,
  //   dataType: [BwCustomComPropDataTypeEnum.function],
  //   defaultValueDataType: BwCustomComPropDataTypeEnum.function,
  //   constValueSetCom: BwComPropSetConstValueComEnum.function,
  //   constValueSetComProps: null,
  //   remark: '',
  // },
  // {
  //   key: 'export-method',
  //   name: '自定义单元格数据导出方法，返回自定义的值',
  //   isRequire: false,
  //   defaultValue: undefined,
  //   dataType: [BwCustomComPropDataTypeEnum.function],
  //   defaultValueDataType: BwCustomComPropDataTypeEnum.function,
  //   constValueSetCom: BwComPropSetConstValueComEnum.function,
  //   constValueSetComProps: null,
  //   remark: '',
  // },
  // {
  //   key: 'footer-export-method',
  //   name: '自定义表尾单元格数据导出方法，返回自定义的值',
  //   isRequire: false,
  //   defaultValue: undefined,
  //   dataType: [BwCustomComPropDataTypeEnum.function],
  //   defaultValueDataType: BwCustomComPropDataTypeEnum.function,
  //   constValueSetCom: BwComPropSetConstValueComEnum.function,
  //   constValueSetComProps: null,
  //   remark: '',
  // },
  {
    key: 'title-prefix',
    name: '标题前缀图标配置项',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.object],
    defaultValueDataType: BwCustomComPropDataTypeEnum.object,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'title-suffix',
    name: '标题后缀图标配置项',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.object],
    defaultValueDataType: BwCustomComPropDataTypeEnum.object,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'cell-type',
    name: '只对特定功能有效，单元格值类型',
    isRequire: false,
    defaultValue: 'auto',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        {
          label: '自动转换',
          value: 'auto',
        },
        {
          label: '数字',
          value: 'number',
        },
        {
          label: '字符串',
          value: 'string',
        },
      ],
    }),
    remark: '',
  },
  {
    key: 'cell-render',
    name: '默认的渲染器配置项',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.object],
    defaultValueDataType: BwCustomComPropDataTypeEnum.object,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'edit-render',
    name: '可编辑渲染器配置项',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.object],
    defaultValueDataType: BwCustomComPropDataTypeEnum.object,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'content-render',
    name: '内容渲染配置项',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.object],
    defaultValueDataType: BwCustomComPropDataTypeEnum.object,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'tree-node',
    name: '只对 tree-config 配置时有效，指定为树节点',
    isRequire: false,
    defaultValue: 'false',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'params',
    name: '额外的参数',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.object],
    defaultValueDataType: BwCustomComPropDataTypeEnum.object,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'col-id',
    name: '自定义列的唯一主键',
    isRequire: false,
    defaultValue: undefined,
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.number,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
]

/** 组件事件 */
const comEmits: Array<BwCustomComEmitInfoModel> = []

/** 组件插槽 */
const comSlots: Array<BwCustomComSlotInfoModel> = [
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'default',
      slotName: '默认插槽，自定义显示内容模板',
      slotParams: [
        {
          paramKey: 'params',
          paramName: '插槽参数',
          paramDataType: BwCustomComSlotParamDataTypeEnum.object,
          remark: '',
        },
      ],
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'header',
      slotName: '自定义表头内容的模板',
      slotParams: [
        {
          paramKey: 'params',
          paramName: '插槽参数',
          paramDataType: BwCustomComSlotParamDataTypeEnum.object,
          remark: '',
        },
      ],
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'footer',
      slotName: '自定义表尾内容的模板',
      slotParams: [
        {
          paramKey: 'params',
          paramName: '插槽参数',
          paramDataType: BwCustomComSlotParamDataTypeEnum.object,
          remark: '',
        },
      ],
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'title',
      slotName: '只对 type=checkbox,radio 有效，自定义标题模板',
      slotParams: [
        {
          paramKey: 'params',
          paramName: '插槽参数',
          paramDataType: BwCustomComSlotParamDataTypeEnum.object,
          remark: '',
        },
      ],
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'checkbox',
      slotName: '只对 type=checkbox 有效，自定义复选框模板',
      slotParams: [
        {
          paramKey: 'params',
          paramName: '插槽参数',
          paramDataType: BwCustomComSlotParamDataTypeEnum.object,
          remark: '',
        },
      ],
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'radio',
      slotName: '只对 type=radio 有效，自定义单选框模板',
      slotParams: [
        {
          paramKey: 'params',
          paramName: '插槽参数',
          paramDataType: BwCustomComSlotParamDataTypeEnum.object,
          remark: '',
        },
      ],
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'content',
      slotName: '只对 type=expand 有效，自定义展开后的内容模板',
      slotParams: [
        {
          paramKey: 'params',
          paramName: '插槽参数',
          paramDataType: BwCustomComSlotParamDataTypeEnum.object,
          remark: '',
        },
      ],
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'filter',
      slotName: '只对 filter-render 启用时有效，自定义筛选模板',
      slotParams: [
        {
          paramKey: 'params',
          paramName: '插槽参数',
          paramDataType: BwCustomComSlotParamDataTypeEnum.object,
          remark: '',
        },
      ],
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'edit',
      slotName: '只对 edit-render 启用时有效，自定义可编辑组件模板',
      slotParams: [
        {
          paramKey: 'params',
          paramName: '插槽参数',
          paramDataType: BwCustomComSlotParamDataTypeEnum.object,
          remark: '',
        },
      ],
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'valid',
      slotName: '只对 edit-rules 与 edit-render 启用时有效，自定义校验提示模板',
      slotParams: [
        {
          paramKey: 'params',
          paramName: '插槽参数',
          paramDataType: BwCustomComSlotParamDataTypeEnum.object,
          remark: '',
        },
      ],
    },
  },
]

export const vxeColumnInfo = {
  comAttrs,
  comEmits,
  comSlots,
}
